<!DOCTYPE html>
<html>
<head>
   <title>CSS Animations - animation referencing invalid keyframes rule</title>
   <link rel="author" title="Opera Software ASA" href="http://www.opera.com/">
   <link rel="help" href="http://dev.w3.org/csswg/css3-animations/#animations">
   <meta name="flags" content="dom invalid">
   <!--
   **************************************************************************
   ISSUE: Spec is not clear on parsing behavior
   **************************************************************************
   -->
   <meta name="assert" content="An animation applies to an element if the
   element has a value for 'animation-name' that references a valid keyframes
   rule">
   <script src="/resources/testharness.js"></script>
   <script src="/resources/testharnessreport.js"></script>
   <style type="text/css">
      @keyframes blacken {
         background-color: black;
      }
      @keyframes whiten {
         to {
            background-color: white;
         }
      }
      div {
         width: 100px;
         height: 100px;
         background: blue;
      }
      .test {
         animation: whiten 1s, blacken 1s;
      }
   </style>
   <script type="text/javascript">
      setup({explicit_done:true});
      onload = function() {
         var testName = document.querySelector('title').firstChild.data;
         var div = document.querySelector('div');
         var log = document.querySelectorAll('p')[1].firstChild;
         var passed;
         setTimeout(function() {
            passed = passed == undefined ? false : passed;
            test(function(){assert_true(passed);}, testName); done();
            log.data = passed ? 'PASS if the animation occurred.' : 'FAIL';
         }, 500);
         div.addEventListener('animationstart', function(evt) {
            if (evt.animationName == 'whiten') {
               passed = true;
            }
         });
         div.className = 'test';
      }
   </script>
   <style>iframe{display:none}</style>
</head>
<body>
   <p>The blue square below should gradually fade to white, then instantly go
   back to blue.</p>
   <p>Testing...</p>
   <div></div>
</body>
</html>
